<template>
  <zm-view ref="view">
    <deco-entry-common ref="deco" :data="indexDeco" page="index"></deco-entry-common>
    <!-- 电影预告播放组件 -->
    <film-trailer-popup></film-trailer-popup>
  </zm-view>
</template>
<script>
import page from "@/mixins/page"
import { mapGetters, mapActions } from "vuex"
export default {
  mixins: [page],
  data() {
    return {}
  },
  onShow() {
    this.handleRefresh()
  },
  onLoad() {
    uni.hideTabBar()
  },
  computed: {
    ...mapGetters(["token", "cityName", "cityCode", "tabbar", "indexDeco", "baseInfo"])
  },
  watch: {
    cityCode: {
      handler() {
        this.handleRefresh()
      }
    },
    indexDeco: {
      handler() {
        this.handleSetShare()
      },
      deep: true,
      immediate: true
    }
  },
  methods: {
    handleSetShare() {
      this.useShare({
        title: this.indexDeco?.config?.shareTitle,
        imageUrl: this.indexDeco?.config?.shareImage
      })
    },
    handleRefresh() {
      this.getIndexDecoInfo()
      this.$refs.deco?.refresh()
    },
    ...mapActions(["getIndexDecoInfo"])
  }
}
</script>

<style lang="scss" scoped></style>
